import store from '@/store'

export default {
  install(Vue) {
    // 注册一个全局自定义指令 `v-allow`
    Vue.directive('allow', {
      inserted: function(el, binding) {
        // 从vuex中取出points,
        const points = store.state.user.userInfo.roles.points
        if (points.includes(binding.value)) {
          console.log('1', binding.value)
        } else {
          el.parentNode.removeChild(el)
        }
      }
    })
  }
}
